<template>
    <div class="index">
        <el-container>
            <el-header style="background-color: #333131;">
                <div style="float: left;" class="s">
                    <span>智慧校园 . 后台管理系统</span>
                </div>
                <div  style="text-align: right; font-size: 12px">
                    <el-dropdown>
                        <i class="el-icon-setting" style="margin-right: 15px; color:#fff"></i>
                        <el-dropdown-menu slot="dropdown">
                        <!-- <el-dropdown-item>个人中心</el-dropdown-item>
                        <el-dropdown-item>布局设置</el-dropdown-item>
                        <el-dropdown-item>退出登录</el-dropdown-item> -->
                        <button @click="sysUserLogout">退出登录</button>
                        
                        </el-dropdown-menu>
                    </el-dropdown>
                    <span style="color: #fff;">{{ userInfoString }}</span>
                </div>
            </el-header>
            <el-container>
                <el-aside width="200px">
                    <!-- <div style="height: 240px;">
                        <img src="" alt="">
                       
                    </div> -->
                    <el-menu default-active="2" class="el-menu-vertical-demo">
                        <el-submenu index="1">
                            <template slot="title"><i class="el-icon-location"></i>
                                <span>安全管理</span>
                            </template>
                            <el-menu-item-group>
                                <el-menu-item index="1-1">隐患管理</el-menu-item>
                                <el-menu-item index="1-2">安全巡查</el-menu-item>
                                <el-menu-item index="1-3">护导管理</el-menu-item>
                                <el-menu-item index="1-4">访机客管理</el-menu-item>
                            </el-menu-item-group>
                        </el-submenu>
                        <el-submenu index="2">
                            <template slot="title"><i class="el-icon-location"></i>
                                <span>考勤管理</span>
                            </template>
                            <el-menu-item-group>
                                <el-menu-item index="2-1">学生考勤</el-menu-item>
                                <el-menu-item index="2-2">教师考勤</el-menu-item>
                            </el-menu-item-group>
                        </el-submenu>
                        <el-submenu index="3">
                            <template slot="title"><i class="el-icon-location"></i>
                                <span>学生管理</span>
                            </template>
                            <el-menu-item-group>
                                <el-menu-item index="3-1">学生管理</el-menu-item>
                            </el-menu-item-group>
                        </el-submenu>
                        <el-submenu index="4">
                            <template slot="title"><i class="el-icon-location"></i>
                                <span>教职工管理</span>
                            </template>
                            <el-menu-item-group>
                                <el-menu-item index="4-1">职工管理</el-menu-item>
                                <el-menu-item index="4-2">教师管理</el-menu-item>
                                <el-menu-item index="4-3">班主任管理</el-menu-item>
                                <el-menu-item index="4-4">班级管理</el-menu-item>
                                <el-menu-item index="4-5">安保管理</el-menu-item>
                            </el-menu-item-group>
                        </el-submenu>
                        <el-submenu index="5">
                            <template slot="title"><i class="el-icon-location"></i>
                                <span>权限管理</span>
                            </template>
                            <el-menu-item-group>
                                <el-menu-item index="5-1"><router-link to="">角色管理</router-link></el-menu-item>
                                <el-menu-item index="5-2"><router-link to="">部门管理</router-link></el-menu-item>
                                <el-menu-item index="5-3"><router-link to="/user">账号管理</router-link></el-menu-item>
                            </el-menu-item-group>
                        </el-submenu>
                    </el-menu>
                </el-aside>
                <el-main>
                    <router-view></router-view>
                </el-main>
            </el-container>
        </el-container>
    </div>
</template>
<script>

import axios from 'axios'

export default {
    name:"Index",
    data(){
        return{
            userInfoString: ''
        }
    },
    created(){
        this.loadUserInfo();
    },
    methods:{
        loadUserInfo(){
            this.userInfoString = localStorage.getItem('nickName');
        },
        sysUserLogout(){
          axios.get("/api/manager/user/logout")
            .then((res)=>{
                console.log(res)
                if (res.data.code == 200) {
                    this.$router.push("/")
                }
            })
        }
    }
}
</script>
<style scoped>
  .el-header{
    background-color: #B3C0D1;
    color: #333;
    text-align: center;
    line-height: 60px;
  }
  
  .el-aside {
    background-color: #D3DCE6;
    color: #333131;
    line-height: 500px;
    height: 500px;
  }
  
  .el-main {
    background-color: #E9EEF3;
    color: #333;
    text-align: center;
    line-height: 160px;
  }
  .s{
    font-family: 'Arial Negreta', 'Arial';
    font-weight: 700;
    font-style: normal;
    font-size: 20px;
    color: #FFFFFF;
  }
</style>